USE [SONALIKA_BGK_UPDATED]
GO

/****** Object:  Table [dbo].[JOB_CARDS]    Script Date: 07-Jun-14 11:53:24 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[JOB_CARDS](
	[JOBCARD_ID] [int] IDENTITY(1,1) NOT NULL,
	[TRACTOR_ID] [int] NULL,
	[SALES_INVOICE_ID] [int] NOT NULL,
	[IS_MOBILESERVICE] [bit] NULL,
	[IS_SERVICECLINIC] [bit] NULL,
	[IS_PAID] [bit] NULL,
	[IS_ACCEDENTAL] [bit] NULL,
	[SERIAL_NUMBER] [int] NULL,
	[ESTIMATED_COST] [decimal](18, 2) NULL,
	[REPEAT_FIR_DETAIL] [varchar](50) NULL,
	[SERVICE_COUPON_NO] [int] NULL,
	[ESTIMATED_DELIVERY] [datetime] NULL,
	[DATETIME_IN] [datetime] NULL,
	[SERVICE_STARTDATETIME] [datetime] NULL,
	[SERVICE_ENDDATETIME] [datetime] NULL,
	[TRACTOR_APPLICATION] [varchar](50) NULL,
	[JOBTRACTOR_ID] [int] NULL,
	[OTHER_REPAIRS] [decimal](18, 2) NULL,
	[WASHING_CHARGE] [decimal](18, 2) NULL,
	[LABOUR_CHARGE] [decimal](18, 2) NULL,
	[REGISTRATION_NO] [varchar](50) NOT NULL,
 CONSTRAINT [PK_JOBCARDS] PRIMARY KEY CLUSTERED 
(
	[JOBCARD_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[JOB_CARDS]  WITH CHECK ADD  CONSTRAINT [FK_JOB_CARDS_JOB_TRACTOR_CUSTOMERS] FOREIGN KEY([JOBTRACTOR_ID])
REFERENCES [dbo].[JOB_TRACTOR_CUSTOMERS] ([JOBTRACTOR_ID])
GO

ALTER TABLE [dbo].[JOB_CARDS] CHECK CONSTRAINT [FK_JOB_CARDS_JOB_TRACTOR_CUSTOMERS]
GO

ALTER TABLE [dbo].[JOB_CARDS]  WITH CHECK ADD  CONSTRAINT [FK_JOB_CARDS_SALES_INVOICES] FOREIGN KEY([SALES_INVOICE_ID])
REFERENCES [dbo].[SALES_INVOICES] ([SALES_INVOICE_ID])
GO

ALTER TABLE [dbo].[JOB_CARDS] CHECK CONSTRAINT [FK_JOB_CARDS_SALES_INVOICES]
GO

ALTER TABLE [dbo].[JOB_CARDS]  WITH CHECK ADD  CONSTRAINT [FK_JOB_CARDS_TRACTOR_PURCHASES] FOREIGN KEY([TRACTOR_ID])
REFERENCES [dbo].[TRACTOR_PURCHASES] ([TRACTOR_ID])
GO

ALTER TABLE [dbo].[JOB_CARDS] CHECK CONSTRAINT [FK_JOB_CARDS_TRACTOR_PURCHASES]
GO

